package com.woniuxy.controller;

import com.woniuxy.entity.RbacPerm;
import com.woniuxy.entity.RbacRole;
import com.woniuxy.entity.ResponseEntity;
import com.woniuxy.service.RbacPermService;
import com.woniuxy.service.RbacRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/rbacPerm")
public class RbacPermController {
    @Autowired
    RbacPermService rbacPermService ;

    @GetMapping("/findAll/{currentPage}/{pageSize}")
    public ResponseEntity findAll(@PathVariable("currentPage") int currentPage, @PathVariable("pageSize") int pageSize){
        return rbacPermService.findAll(currentPage,pageSize);
    }
    @GetMapping("/{id}")
    public ResponseEntity findOne(@PathVariable("id") int id){
        return rbacPermService.findOne(id);
    }
    @GetMapping("/{currentPage}/{pageSize}")
    public ResponseEntity search(@PathVariable("currentPage") int currentPage, @PathVariable("pageSize") int pageSize, @RequestParam("key") String key, @RequestParam("key1") String key1) {
        return rbacPermService.search(currentPage, pageSize, key, key1);
    }
    @PostMapping("/")
    public ResponseEntity addOne(@RequestBody RbacPerm rbacPerm){
        return rbacPermService.addOne(rbacPerm);
    }
    @DeleteMapping("/{id}")
    public ResponseEntity deleteOne(@PathVariable int id){
        return rbacPermService.deleteOne(id);
    }
    @PutMapping("/")
    public ResponseEntity updateOne(@RequestBody RbacPerm rbacPerm){
        return rbacPermService.updateOne(rbacPerm);
    }
}
